/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ImagePanel.java
 *
 * Created on 17-Mar-2012, 20:51:39
 */

package eOlympics.ui;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;

/**
 *
 * @author Lourdes
 */
public class ImagePanel extends javax.swing.JPanel {

    private BufferedImage image;
    private static String PATH = "resources/images/";

    /** Creates new form ImagePanel */
    public ImagePanel() {
        initComponents();
        this.setSize(30,60);
        this.setBackground(Color.white);

        try {
          image = ImageIO.read(new File(PATH + "logo-eolympics-300x200.png"));
       } catch (Exception ex) {
           System.out.println("error imagen: " + ex.getMessage());
           File f = new File(".");
            System.out.println(f.getAbsoluteFile());
          this.setBackground(Color.red);
       }
      
    }

  
    @Override
    public void paint(Graphics g) {
        super.paint(g);
        g.drawImage(image, 0, 0, null); // see javadoc for more info on the parameters

    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 300, Short.MAX_VALUE)
        );
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables

}
